<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script>
			function creatXMLHttpRequest(){
				var xmlhttprequest;
				if (window.ActiveXObject) {
					try{
						xmlhttprequest = new ActiveXObject("Msxml2.XMLHTTP");
					}catch(e){
						xmlhttprequest = new ActiveXObject("Microsoft.XMLHTTP");
					}
				} else{
					xmlhttprequest = new XMLHttpRequest();
				}
				return xmlhttprequest;
			}
			function fun(){
				var xhr = creatXMLHttpRequest();
				xhr.open("GET","person.json",false);
				xhr.send();
				//var data = JSON.parse(xhr.responseText);
				var data = eval("("+xhr.responseText+")");
				document.getElementById("sno").innerHTML = data.sno;
				document.getElementById("name").innerHTML = data.name;
				document.getElementById("age").innerHTML = data.age;
				
			}
		</script>
	</head>
	<body>
		学号：<span id="sno"></span><br />
		姓名：<span id="name"></span><br />
		年龄：<span id="age"></span><br />
		<button onclick="fun()">请求数据</button>
	</body>
</html>
